package com.glory.gloryquickui.widget.text;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.glory.gloryquickui.R;

/**
 * FileName: CustomDateTextView
 * Author: XJH
 * Date: 2021/4/20 16:02
 * Description:
 * History:
 */
public class CustomDateTextView extends RelativeLayout {

    private final TextView tvStartDateValue;
    private final TextView tvEndDateValue;
    private final TextView tvMiddleDateValue;
    private final ImageView ivArrow;

    public CustomDateTextView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        View view = LayoutInflater.from(context).inflate(R.layout.text_date_choose, this, true);
        tvStartDateValue = view.findViewById(R.id.tvStartDateValue);
        tvEndDateValue = view.findViewById(R.id.tvEndDateValue);
        tvMiddleDateValue = view.findViewById(R.id.tvMiddleDateValue);
        ivArrow = view.findViewById(R.id.ivArrow);

    }

    public void setStartHint(String hint){
        tvStartDateValue.setHint(hint);
    }

    public void setMiddleHint(String hint){
        tvMiddleDateValue.setHint(hint);
    }

    public void setEndHint(String hint){
        tvEndDateValue.setHint(hint);
    }

    public void setText(String start,String end){
        tvStartDateValue.setText(start);
        tvEndDateValue.setText(end);
    }

    public String getStartText() {
        return tvStartDateValue.getText().toString().trim();
    }

    public String getEndText(){
        return tvEndDateValue.getText().toString().trim();
    }

    public String getText(String spilt){
        return tvStartDateValue.getText().toString().trim() + spilt + tvEndDateValue.getText().toString().trim();
    }
}
